package com.smday.tree;

import java.util.Collection;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * @author Summerday
 */
public interface Tree<E> extends Collection<E> {

    @Override
    default int size(){
        return getSize();
    }

    @Override
    default boolean isEmpty(){
        return size() == 0;
    }

    @Override
    default boolean contains(Object o){
        return search((E) o);
    }

    @Override
    Iterator<E> iterator();

    @Override
    default Object[] toArray(){
        return null;
    }

    @Override
    default <T> T[] toArray(T[] a){
        return null;
    }

    @Override
    default boolean add(E e) {
        return insert(e);
    }

    @Override
    default boolean remove(Object o) {
        return delete((E) o);
    }

    @Override
    default boolean containsAll(Collection<?> c) {
        return false;
    }

    @Override
    default boolean addAll(Collection<? extends E> c){
        return false;
    }

    @Override
    default boolean removeAll(Collection<?> c){
        return false;
    }

    @Override
    default boolean retainAll(Collection<?> c){
        return false;
    }

    @Override
    void clear();

    /**
     * 查找元素,存在则为true
     *
     * @param e
     * @return
     */
    public boolean search(E e);

    public boolean insert(E e);

    public boolean delete(E e);

    public int getSize();

    public default void inOrder() {

    }

    public default void postOrder() {

    }

    public default void preOrder() {

    }


}
